home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / gcc263-utildoc.lha / gnu / man / man1 / flex.1 < prev    next >
Encoding:
Text File  |  1994-12-19  |  37.1 KB  |  859 lines

  1.  
  2.  
  3.  
  4. FLEX(1)                                                   FLEX(1)
  5.  
  6.  
  7. NNAAMMEE
  8.        flex - fast lexical analyzer generator
  9.  
  10. SSYYNNOOPPSSIISS
  11.        fflleexx [[--bbccddffhhiillnnppssttvvwwBBFFIILLTTVV7788++ --CC[[aaeeffFFmmrr]] --PPpprreeffiixx --SSsskkeellee--
  12.        ttoonn]] _[_f_i_l_e_n_a_m_e _._._._]
  13.  
  14. DDEESSCCRRIIPPTTIIOONN
  15.        _f_l_e_x is a tool for  generating  _s_c_a_n_n_e_r_s_:  programs  which
  16.        recognized lexical patterns in text.  _f_l_e_x reads the given
  17.        input files, or its standard input if no  file  names  are
  18.        given,  for  a  description of a scanner to generate.  The
  19.        description is in the form of pairs of regular expressions
  20.        and  C  code,  called  _r_u_l_e_s_. _f_l_e_x generates as output a C
  21.        source file, lleexx..yyyy..cc,, which defines  a  routine  yyyylleexx(())..
  22.        This  file is compiled and linked with the --llffll library to
  23.        produce an executable.  When the  executable  is  run,  it
  24.        analyzes  its input for occurrences of the regular expres-
  25.        sions.  Whenever it finds one, it executes the correspond-
  26.        ing C code.
  27.  
  28.        For full documentation, see fflleexxddoocc((11))..  This manual entry
  29.        is intended for use as a quick reference.
  30.  
  31. OOPPTTIIOONNSS
  32.        _f_l_e_x has the following options:
  33.  
  34.        --bb     generate  backing-up  information  to   _l_e_x_._b_a_c_k_u_p_.
  35.               This  is  a  list  of  scanner states which require
  36.               backing up and the input characters on  which  they
  37.               do  so.   By adding rules one can remove backing-up
  38.               states.  If all backing-up  states  are  eliminated
  39.               and  --CCff or --CCFF is used, the generated scanner will
  40.               run faster.
  41.  
  42.        --cc     is a do-nothing,  deprecated  option  included  for
  43.               POSIX compliance.
  44.  
  45.               NNOOTTEE::  in  previous  releases  of _f_l_e_x --cc specified
  46.               table-compression options.  This  functionality  is
  47.               now  given  by the --CC flag.  To ease the the impact
  48.               of this change, when _f_l_e_x encounters  --cc,,  it  cur-
  49.               rently issues a warning message and assumes that --CC
  50.               was desired instead.  In the  future  this  "promo-
  51.               tion"  of --cc to --CC will go away in the name of full
  52.               POSIX  compliance  (unless  the  POSIX  meaning  is
  53.               removed first).
  54.  
  55.        --dd     makes  the  generated  scanner  run  in _d_e_b_u_g mode.
  56.               Whenever a pattern is  recognized  and  the  global
  57.               yyyy__fflleexx__ddeebbuugg  is  non-zero (which is the default),
  58.               the scanner will write to  _s_t_d_e_r_r  a  line  of  the
  59.               form:
  60.  
  61.  
  62.  
  63.  
  64. Version 2.4               November 1993                         1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FLEX(1)                                                   FLEX(1)
  71.  
  72.  
  73.                   --accepting rule at line 53 ("the matched text")
  74.  
  75.               The  line number refers to the location of the rule
  76.               in the file defining the scanner  (i.e.,  the  file
  77.               that was fed to flex).  Messages are also generated
  78.               when the scanner  backs  up,  accepts  the  default
  79.               rule,  reaches  the  end  of  its  input buffer (or
  80.               encounters a NUL; the two look the same as  far  as
  81.               the  scanner's  concerned),  or  reaches an end-of-
  82.               file.
  83.  
  84.        --ff     specifies _f_a_s_t _s_c_a_n_n_e_r_.  No  table  compression  is
  85.               done  and  stdio  is bypassed.  The result is large
  86.               but fast.  This option is equivalent to  --CCffrr  (see
  87.               below).
  88.  
  89.        --hh     generates  a  "help"  summary  of _f_l_e_x_'_s options to
  90.               _s_t_d_e_r_r and then exits.
  91.  
  92.        --ii     instructs _f_l_e_x to generate a _c_a_s_e_-_i_n_s_e_n_s_i_t_i_v_e scan-
  93.               ner.   The  case of letters given in the _f_l_e_x input
  94.               patterns will be ignored, and tokens in  the  input
  95.               will  be  matched  regardless of case.  The matched
  96.               text given in _y_y_t_e_x_t will have the  preserved  case
  97.               (i.e., it will not be folded).
  98.  
  99.        --ll     turns  on  maximum  compatibility with the original
  100.               AT&T lex implementation, at a considerable  perfor-
  101.               mance  cost.   This option is incompatible with --++,,
  102.               --ff,, --FF,, --CCff,, or --CCFF..  See _f_l_e_x_d_o_c_(_1_) for details.
  103.  
  104.        --nn     is another do-nothing, deprecated  option  included
  105.               only for POSIX compliance.
  106.  
  107.        --pp     generates  a  performance  report  to  stderr.  The
  108.               report consists of comments regarding  features  of
  109.               the _f_l_e_x input file which will cause a loss of per-
  110.               formance in the resulting scanner.  If you give the
  111.               flag  twice,  you  will also get comments regarding
  112.               features that lead to minor performance losses.
  113.  
  114.        --ss     causes the _d_e_f_a_u_l_t  _r_u_l_e  (that  unmatched  scanner
  115.               input  is  echoed  to _s_t_d_o_u_t_) to be suppressed.  If
  116.               the scanner encounters input that  does  not  match
  117.               any of its rules, it aborts with an error.
  118.  
  119.        --tt     instructs _f_l_e_x to write the scanner it generates to
  120.               standard output instead of lleexx..yyyy..cc..
  121.  
  122.        --vv     specifies that _f_l_e_x should write to _s_t_d_e_r_r  a  sum-
  123.               mary  of statistics regarding the scanner it gener-
  124.               ates.
  125.  
  126.        --ww     suppresses warning messages.
  127.  
  128.  
  129.  
  130. Version 2.4               November 1993                         2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FLEX(1)                                                   FLEX(1)
  137.  
  138.  
  139.        --BB     instructs _f_l_e_x to generate a _b_a_t_c_h scanner  instead
  140.               of  an  _i_n_t_e_r_a_c_t_i_v_e  scanner  (see  --II below).  See
  141.               _f_l_e_x_d_o_c_(_1_) for details.  Scanners using --CCff or  --CCFF
  142.               compression   options  automatically  specify  this
  143.               option, too.
  144.  
  145.        --FF     specifies that the _f_a_s_t scanner  table  representa-
  146.               tion  should  be  used  (and stdio bypassed).  This
  147.               representation is about as fast as the  full  table
  148.               representation  ((--ff)),, and for some sets of patterns
  149.               will  be  considerably  smaller  (and  for  others,
  150.               larger).   It  cannot  be  used with the --++ option.
  151.               See fflleexxddoocc((11)) for more details.
  152.  
  153.               This option is equivalent to --CCFFrr (see below).
  154.  
  155.        --II     instructs _f_l_e_x to generate an _i_n_t_e_r_a_c_t_i_v_e  scanner,
  156.               that  is,  a scanner which stops immediately rather
  157.               than looking ahead if it knows that  the  currently
  158.               scanned  text  cannot  be  part  of a longer rule's
  159.               match.  This is the opposite of _b_a_t_c_h scanners (see
  160.               --BB above).  See fflleexxddoocc((11)) for details.
  161.  
  162.               Note, --II cannot be used in conjunction with _f_u_l_l or
  163.               _f_a_s_t _t_a_b_l_e_s_, i.e., the --ff,, --FF,, --CCff,, or  --CCFF  flags.
  164.               For  other  table  compression  options,  --II is the
  165.               default.
  166.  
  167.        --LL     instructs _f_l_e_x not to generate ##lliinnee directives  in
  168.               lleexx..yyyy..cc..   The  default is to generate such direc-
  169.               tives so error messages in the actions will be cor-
  170.               rectly  located  with  respect to the original _f_l_e_x
  171.               input file, and not to the fairly meaningless  line
  172.               numbers of lleexx..yyyy..cc..
  173.  
  174.        --TT     makes  _f_l_e_x  run in _t_r_a_c_e mode.  It will generate a
  175.               lot of messages to _s_t_d_e_r_r concerning  the  form  of
  176.               the  input  and the resultant non-deterministic and
  177.               deterministic  finite  automata.   This  option  is
  178.               mostly for use in maintaining _f_l_e_x_.
  179.  
  180.        --VV     prints the version number to _s_t_d_e_r_r and exits.
  181.  
  182.        --77     instructs  _f_l_e_x  to generate a 7-bit scanner, which
  183.               can save considerable table space, especially  when
  184.               using  --CCff  or --CCFF (and, at most sites, --77 is on by
  185.               default for these options.  To see if this  is  the
  186.               case,  use  the  --vv verbose flag and check the flag
  187.               summary it reports).
  188.  
  189.        --88     instructs _f_l_e_x to generate an 8-bit scanner.   This
  190.               is  the default except for the --CCff and --CCFF compres-
  191.               sion  options,  for  which  the  default  is  site-
  192.               dependent,  and  can  be  checked by inspecting the
  193.  
  194.  
  195.  
  196. Version 2.4               November 1993                         3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. FLEX(1)                                                   FLEX(1)
  203.  
  204.  
  205.               flag summary generated by the --vv option.
  206.  
  207.        --++     specifies that you want  flex  to  generate  a  C++
  208.               scanner  class.   See the section on Generating C++
  209.               Scanners in _f_l_e_x_d_o_c_(_1_) for details.
  210.  
  211.        --CC[[aaeeffFFmmrr]]
  212.               controls the degree of table compression and  scan-
  213.               ner optimization.
  214.  
  215.               --CCaa  trade off larger tables in the generated scan-
  216.               ner for faster performance because the elements  of
  217.               the tables are better aligned for memory access and
  218.               computation.  This option can double  the  size  of
  219.               the tables used by your scanner.
  220.  
  221.               --CCee  directs _f_l_e_x to construct _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s_e_s_,
  222.               i.e., sets of characters which have identical lexi-
  223.               cal  properties.   Equivalence classes usually give
  224.               dramatic reductions in the final table/object  file
  225.               sizes  (typically  a  factor of 2-5) and are pretty
  226.               cheap performance-wise (one array look-up per char-
  227.               acter scanned).
  228.  
  229.               --CCff  specifies  that the _f_u_l_l scanner tables should
  230.               be generated - _f_l_e_x should not compress the  tables
  231.               by  taking  advantages  of similar transition func-
  232.               tions for different states.
  233.  
  234.               --CCFF specifies that the alternate fast scanner  rep-
  235.               resentation  (described  in  fflleexxddoocc((11))))  should be
  236.               used.  This option cannot be used with --++..
  237.  
  238.               --CCmm  directs  _f_l_e_x  to  construct  _m_e_t_a_-_e_q_u_i_v_a_l_e_n_c_e
  239.               _c_l_a_s_s_e_s_,  which are sets of equivalence classes (or
  240.               characters, if equivalence classes  are  not  being
  241.               used)  that  are  commonly  used  together.   Meta-
  242.               equivalence classes are often a big win when  using
  243.               compressed tables, but they have a moderate perfor-
  244.               mance impact (one or two "if" tests and  one  array
  245.               look-up per character scanned).
  246.  
  247.               --CCrr  causes  the  generated scanner to _b_y_p_a_s_s using
  248.               stdio for input.  In general this option results in
  249.               a minor performance gain only worthwhile if used in
  250.               conjunction with --CCff or --CCFF..  It can cause surpris-
  251.               ing behavior if you use stdio yourself to read from
  252.               _y_y_i_n prior to calling the scanner.
  253.  
  254.               A lone --CC specifies that the scanner tables  should
  255.               be  compressed  but neither equivalence classes nor
  256.               meta-equivalence classes should be used.
  257.  
  258.               The options --CCff or --CCFF and --CCmm do  not  make  sense
  259.  
  260.  
  261.  
  262. Version 2.4               November 1993                         4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. FLEX(1)                                                   FLEX(1)
  269.  
  270.  
  271.               together  -  there  is  no  opportunity  for  meta-
  272.               equivalence classes if the table is not being  com-
  273.               pressed.   Otherwise  the  options  may  be  freely
  274.               mixed.
  275.  
  276.               The default setting is --CCeemm,, which  specifies  that
  277.               _f_l_e_x  should generate equivalence classes and meta-
  278.               equivalence classes.   This  setting  provides  the
  279.               highest degree of table compression.  You can trade
  280.               off faster-executing scanners at the cost of larger
  281.               tables with the following generally being true:
  282.  
  283.                   slowest & smallest
  284.                         -Cem
  285.                         -Cm
  286.                         -Ce
  287.                         -C
  288.                         -C{f,F}e
  289.                         -C{f,F}
  290.                         -C{f,F}a
  291.                   fastest & largest
  292.  
  293.  
  294.               --CC options are cumulative.
  295.  
  296.        --PPpprreeffiixx
  297.               changes  the  default  _y_y prefix used by _f_l_e_x to be
  298.               _p_r_e_f_i_x instead.  See _f_l_e_x_d_o_c_(_1_) for  a  description
  299.               of  all  the  global  variables and file names that
  300.               this affects.
  301.  
  302.        --SSsskkeelleettoonn__ffiillee
  303.               overrides the default skeleton file from which _f_l_e_x
  304.               constructs  its  scanners.   You'll never need this
  305.               option unless you are  doing  _f_l_e_x  maintenance  or
  306.               development.
  307.  
  308. SSUUMMMMAARRYY OOFF FFLLEEXX RREEGGUULLAARR EEXXPPRREESSSSIIOONNSS
  309.        The  patterns  in  the input are written using an extended
  310.        set of regular expressions.  These are:
  311.  
  312.            x          match the character 'x'
  313.            .          any character except newline
  314.            [xyz]      a "character class"; in this case, the pattern
  315.                         matches either an 'x', a 'y', or a 'z'
  316.            [abj-oZ]   a "character class" with a range in it; matches
  317.                         an 'a', a 'b', any letter from 'j' through 'o',
  318.                         or a 'Z'
  319.            [^A-Z]     a "negated character class", i.e., any character
  320.                         but those in the class.  In this case, any
  321.                         character EXCEPT an uppercase letter.
  322.            [^A-Z\n]   any character EXCEPT an uppercase letter or
  323.                         a newline
  324.            r*         zero or more r's, where r is any regular expression
  325.  
  326.  
  327.  
  328. Version 2.4               November 1993                         5
  329.  
  330.  
  331.  
  332.  
  333.  
  334. FLEX(1)                                                   FLEX(1)
  335.  
  336.  
  337.            r+         one or more r's
  338.            r?         zero or one r's (that is, "an optional r")
  339.            r{2,5}     anywhere from two to five r's
  340.            r{2,}      two or more r's
  341.            r{4}       exactly 4 r's
  342.            {name}     the expansion of the "name" definition
  343.                       (see above)
  344.            "[xyz]\"foo"
  345.                       the literal string: [xyz]"foo
  346.            \X         if X is an 'a', 'b', 'f', 'n', 'r', 't', or 'v',
  347.                         then the ANSI-C interpretation of \x.
  348.                         Otherwise, a literal 'X' (used to escape
  349.                         operators such as '*')
  350.            \123       the character with octal value 123
  351.            \x2a       the character with hexadecimal value 2a
  352.            (r)        match an r; parentheses are used to override
  353.                         precedence (see below)
  354.  
  355.  
  356.            rs         the regular expression r followed by the
  357.                         regular expression s; called "concatenation"
  358.  
  359.  
  360.            r|s        either an r or an s
  361.  
  362.  
  363.            r/s        an r but only if it is followed by an s.  The
  364.                         s is not part of the matched text.  This type
  365.                         of pattern is called as "trailing context".
  366.            ^r         an r, but only at the beginning of a line
  367.            r$         an r, but only at the end of a line.  Equivalent
  368.                         to "r/\n".
  369.  
  370.  
  371.            <s>r       an r, but only in start condition s (see
  372.                       below for discussion of start conditions)
  373.            <s1,s2,s3>r
  374.                       same, but in any of start conditions s1,
  375.                       s2, or s3
  376.            <*>r       an r in any start condition, even an exclusive one.
  377.  
  378.  
  379.            <<EOF>>    an end-of-file
  380.            <s1,s2><<EOF>>
  381.                       an end-of-file when in start condition s1 or s2
  382.  
  383.        The regular expressions listed above are grouped according
  384.        to  precedence, from highest precedence at the top to low-
  385.        est at the bottom.   Those  grouped  together  have  equal
  386.        precedence.
  387.  
  388.        Some notes on patterns:
  389.  
  390.        -      Negated  character  classes  _m_a_t_c_h  _n_e_w_l_i_n_e_s unless
  391.  
  392.  
  393.  
  394. Version 2.4               November 1993                         6
  395.  
  396.  
  397.  
  398.  
  399.  
  400. FLEX(1)                                                   FLEX(1)
  401.  
  402.  
  403.               "\n" (or an equivalent escape sequence) is  one  of
  404.               the  characters  explicitly  present in the negated
  405.               character class (e.g., "[^A-Z\n]").
  406.  
  407.        -      A rule can have at most one  instance  of  trailing
  408.               context  (the  '/'  operator  or the '$' operator).
  409.               The start condition, '^',  and  "<<EOF>>"  patterns
  410.               can  only occur at the beginning of a pattern, and,
  411.               as well as with '/'  and  '$',  cannot  be  grouped
  412.               inside parentheses.  The following are all illegal:
  413.  
  414.                   foo/bar$
  415.                   foo|(bar$)
  416.                   foo|^bar
  417.                   <sc1>foo<sc2>bar
  418.  
  419.  
  420. SSUUMMMMAARRYY OOFF SSPPEECCIIAALL AACCTTIIOONNSS
  421.        In addition to arbitrary C code, the following can  appear
  422.        in actions:
  423.  
  424.        -      EECCHHOO copies yytext to the scanner's output.
  425.  
  426.        -      BBEEGGIINN  followed  by  the  name of a start condition
  427.               places the scanner in the corresponding start  con-
  428.               dition.
  429.  
  430.        -      RREEJJEECCTT  directs  the  scanner  to proceed on to the
  431.               "second best" rule which matched the  input  (or  a
  432.               prefix of the input).  yyyytteexxtt and yyyylleenngg are set up
  433.               appropriately.  Note that RREEJJEECCTT is a  particularly
  434.               expensive  feature in terms scanner performance; if
  435.               it is used in _a_n_y of the scanner's actions it  will
  436.               slow  down _a_l_l of the scanner's matching.  Further-
  437.               more, RREEJJEECCTT cannot be  used  with  the  --ff  or  --FF
  438.               options.
  439.  
  440.               Note  also  that  unlike the other special actions,
  441.               RREEJJEECCTT is a _b_r_a_n_c_h_; code immediately  following  it
  442.               in the action will _n_o_t be executed.
  443.  
  444.        -      yyyymmoorree(())  tells  the  scanner that the next time it
  445.               matches a rule, the corresponding token  should  be
  446.               _a_p_p_e_n_d_e_d  onto  the  current value of yyyytteexxtt rather
  447.               than replacing it.
  448.  
  449.        -      yyyylleessss((nn)) returns all but the first _n characters of
  450.               the  current  token back to the input stream, where
  451.               they will be rescanned when the scanner  looks  for
  452.               the  next  match.   yyyytteexxtt  and yyyylleenngg are adjusted
  453.               appropriately (e.g., yyyylleenngg will now be equal to  _n
  454.               ).
  455.  
  456.        -      uunnppuutt((cc))  puts  the character _c back onto the input
  457.  
  458.  
  459.  
  460. Version 2.4               November 1993                         7
  461.  
  462.  
  463.  
  464.  
  465.  
  466. FLEX(1)                                                   FLEX(1)
  467.  
  468.  
  469.               stream.  It will be the next character scanned.
  470.  
  471.        -      iinnppuutt(()) reads the next  character  from  the  input
  472.               stream  (this  routine  is  called yyyyiinnppuutt(()) if the
  473.               scanner is compiled using CC++++))..
  474.  
  475.        -      yyyytteerrmmiinnaattee(()) can be  used  in  lieu  of  a  return
  476.               statement  in an action.  It terminates the scanner
  477.               and returns a 0 to the scanner's caller, indicating
  478.               "all done".
  479.  
  480.               By  default,  yyyytteerrmmiinnaattee(())  is also called when an
  481.               end-of-file is encountered.  It is a macro and  may
  482.               be redefined.
  483.  
  484.        -      YYYY__NNEEWW__FFIILLEE  is an action available only in <<EOF>>
  485.               rules.  It means "Okay, I've set  up  a  new  input
  486.               file,   continue   scanning".    It  is  no  longer
  487.               required; you can just assign _y_y_i_n to  point  to  a
  488.               new file in the <<EOF>> action.
  489.  
  490.        -      yyyy__ccrreeaattee__bbuuffffeerr(( ffiillee,, ssiizzee )) takes a _F_I_L_E pointer
  491.               and an integer _s_i_z_e_.  It returns a  YY_BUFFER_STATE
  492.               handle  to a new input buffer large enough to acco-
  493.               modate _s_i_z_e  characters  and  associated  with  the
  494.               given file.  When in doubt, use YYYY__BBUUFF__SSIIZZEE for the
  495.               size.
  496.  
  497.        -      yyyy__sswwiittcchh__ttoo__bbuuffffeerr((  nneeww__bbuuffffeerr  ))  switches   the
  498.               scanner's  processing  to  scan for tokens from the
  499.               given buffer, which must be a YY_BUFFER_STATE.
  500.  
  501.        -      yyyy__ddeelleettee__bbuuffffeerr((  bbuuffffeerr  ))  deletes   the   given
  502.               buffer.
  503.  
  504. VVAALLUUEESS AAVVAAIILLAABBLLEE TTOO TTHHEE UUSSEERR
  505.        -      cchhaarr  **yyyytteexxtt  holds the text of the current token.
  506.               It may be modified but not lengthened  (you  cannot
  507.               append  characters to the end).  Modifying the last
  508.               character may affect the activity of rules anchored
  509.               using  '^' during the next scan; see fflleexxddoocc((11)) for
  510.               details.
  511.  
  512.               If the special  directive  %%aarrrraayy  appears  in  the
  513.               first  section  of  the  scanner  description, then
  514.               yyyytteexxtt is  instead  declared  cchhaarr  yyyytteexxtt[[YYYYLLMMAAXX]],,
  515.               where  YYYYLLMMAAXX  is  a  macro definition that you can
  516.               redefine in the first section if you don't like the
  517.               default   value   (generally  8KB).   Using  %%aarrrraayy
  518.               results in somewhat slower scanners, but the  value
  519.               of  yyyytteexxtt  becomes  immune to calls to _i_n_p_u_t_(_) and
  520.               _u_n_p_u_t_(_)_, which potentially destroy its  value  when
  521.               yyyytteexxtt  is  a  character  pointer.  The opposite of
  522.               %%aarrrraayy is %%ppooiinntteerr,, which is the default.
  523.  
  524.  
  525.  
  526. Version 2.4               November 1993                         8
  527.  
  528.  
  529.  
  530.  
  531.  
  532. FLEX(1)                                                   FLEX(1)
  533.  
  534.  
  535.               You cannot use %%aarrrraayy when generating  C++  scanner
  536.               classes (the --++ flag).
  537.  
  538.        -      iinntt yyyylleenngg holds the length of the current token.
  539.  
  540.        -      FFIILLEE  **yyyyiinn is the file which by default _f_l_e_x reads
  541.               from.  It may be redefined but doing so only  makes
  542.               sense  before  scanning  begins or after an EOF has
  543.               been encountered.  Changing  it  in  the  midst  of
  544.               scanning  will  have  unexpected results since _f_l_e_x
  545.               buffers its input; use yyyyrreessttaarrtt(())  instead.   Once
  546.               scanning terminates because an end-of-file has been
  547.               seen, yyoouu ccaann aassssiiggnn _y_y_i_n at the new input file and
  548.               then call the scanner again to continue scanning.
  549.  
  550.        -      vvooiidd  yyyyrreessttaarrtt((  FFIILLEE **nneeww__ffiillee )) may be called to
  551.               point _y_y_i_n at the new input file.  The  switch-over
  552.               to  the  new  file  is  immediate  (any  previously
  553.               buffered-up input  is  lost).   Note  that  calling
  554.               yyyyrreessttaarrtt(())  with  _y_y_i_n  as an argument thus throws
  555.               away the current input buffer and  continues  scan-
  556.               ning the same input file.
  557.  
  558.        -      FFIILLEE  **yyyyoouutt  is the file to which EECCHHOO actions are
  559.               done.  It can be reassigned by the user.
  560.  
  561.        -      YYYY__CCUURRRREENNTT__BBUUFFFFEERR returns a YYYY__BBUUFFFFEERR__SSTTAATTEE  handle
  562.               to the current buffer.
  563.  
  564.        -      YYYY__SSTTAARRTT  returns an integer value corresponding to
  565.               the current start condition.  You can  subsequently
  566.               use  this  value with BBEEGGIINN to return to that start
  567.               condition.
  568.  
  569. MMAACCRROOSS AANNDD FFUUNNCCTTIIOONNSS YYOOUU CCAANN RREEDDEEFFIINNEE
  570.        -      YYYY__DDEECCLL  controls  how  the  scanning  routine   is
  571.               declared.   By default, it is "int yylex()", or, if
  572.               prototypes are being used, "int yylex(void)".  This
  573.               definition   may   be  changed  by  redefining  the
  574.               "YY_DECL" macro.  Note that if you  give  arguments
  575.               to  the  scanning  routine  using  a K&R-style/non-
  576.               prototyped function declaration, you must terminate
  577.               the definition with a semi-colon (;).
  578.  
  579.        -      The nature of how the scanner gets its input can be
  580.               controlled  by  redefining  the   YYYY__IINNPPUUTT   macro.
  581.               YY_INPUT's        calling        sequence        is
  582.               "YY_INPUT(buf,result,max_size)".  Its action is  to
  583.               place  up  to  _m_a_x___s_i_z_e characters in the character
  584.               array _b_u_f and return in the integer variable _r_e_s_u_l_t
  585.               either  the  number  of characters read or the con-
  586.               stant YY_NULL (0 on Unix systems) to indicate  EOF.
  587.               The  default  YY_INPUT  reads from the global file-
  588.               pointer "yyin".  A sample redefinition of  YY_INPUT
  589.  
  590.  
  591.  
  592. Version 2.4               November 1993                         9
  593.  
  594.  
  595.  
  596.  
  597.  
  598. FLEX(1)                                                   FLEX(1)
  599.  
  600.  
  601.               (in the definitions section of the input file):
  602.  
  603.                   %{
  604.                   #undef YY_INPUT
  605.                   #define YY_INPUT(buf,result,max_size) \
  606.                       { \
  607.                       int c = getchar(); \
  608.                       result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
  609.                       }
  610.                   %}
  611.  
  612.  
  613.        -      When the scanner receives an end-of-file indication
  614.               from YY_INPUT, it then checks the function yyyywwrraapp(())
  615.               function.   If  yyyywwrraapp(()) returns false (zero), then
  616.               it is assumed that the function has gone ahead  and
  617.               set  up  _y_y_i_n  to  point to another input file, and
  618.               scanning continues.  If it returns true (non-zero),
  619.               then  the  scanner  terminates,  returning 0 to its
  620.               caller.
  621.  
  622.               The default yyyywwrraapp(()) always returns 1.
  623.  
  624.        -      YY_USER_ACTION  can  be  redefined  to  provide  an
  625.               action  which  is  always  executed  prior  to  the
  626.               matched rule's action.
  627.  
  628.        -      The macro YYYY__UUSSEERR__IINNIITT may be redefined to  provide
  629.               an action which is always executed before the first
  630.               scan.
  631.  
  632.        -      In the generated scanner, the actions are all gath-
  633.               ered  in  one  large switch statement and separated
  634.               using  YYYY__BBRREEAAKK,,  which  may  be   redefined.    By
  635.               default,  it  is simply a "break", to separate each
  636.               rule's action from the following rule's.
  637.  
  638. FFIILLEESS
  639.        --llffll   library with which to link scanners to  obtain  the
  640.               default versions of _y_y_w_r_a_p_(_) and/or _m_a_i_n_(_)_.
  641.  
  642.        _l_e_x_._y_y_._c
  643.               generated scanner (called _l_e_x_y_y_._c on some systems).
  644.  
  645.        _l_e_x_._y_y_._c_c
  646.               generated C++ scanner class, when using --++..
  647.  
  648.        _<_F_l_e_x_L_e_x_e_r_._h_>
  649.               header file defining the C++  scanner  base  class,
  650.               FFlleexxLLeexxeerr,, and its derived class, yyyyFFlleexxLLeexxeerr..
  651.  
  652.        _f_l_e_x_._s_k_l
  653.               skeleton  scanner.   This  file  is  only used when
  654.               building flex, not when flex executes.
  655.  
  656.  
  657.  
  658. Version 2.4               November 1993                        10
  659.  
  660.  
  661.  
  662.  
  663.  
  664. FLEX(1)                                                   FLEX(1)
  665.  
  666.  
  667.        _l_e_x_._b_a_c_k_u_p
  668.               backing-up information for --bb flag (called  _l_e_x_._b_c_k
  669.               on some systems).
  670.  
  671. SSEEEE AALLSSOO
  672.        flexdoc(1), lex(1), yacc(1), sed(1), awk(1).
  673.  
  674.        M.  E. Lesk and E. Schmidt, _L_E_X _- _L_e_x_i_c_a_l _A_n_a_l_y_z_e_r _G_e_n_e_r_a_-
  675.        _t_o_r
  676.  
  677. DDIIAAGGNNOOSSTTIICCSS
  678.        _r_e_j_e_c_t___u_s_e_d___b_u_t___n_o_t___d_e_t_e_c_t_e_d _u_n_d_e_f_i_n_e_d or
  679.  
  680.        _y_y_m_o_r_e___u_s_e_d___b_u_t___n_o_t___d_e_t_e_c_t_e_d _u_n_d_e_f_i_n_e_d _- These errors  can
  681.        occur  at  compile  time.   They indicate that the scanner
  682.        uses RREEJJEECCTT or yyyymmoorree(()) but that _f_l_e_x failed to notice the
  683.        fact,  meaning  that  _f_l_e_x  scanned the first two sections
  684.        looking for occurrences of these  actions  and  failed  to
  685.        find  any,  but  somehow you snuck some in (via a #include
  686.        file, for example).  Make an  explicit  reference  to  the
  687.        action  in  your  _f_l_e_x  input file.  (Note that previously
  688.        _f_l_e_x supported a %%uusseedd//%%uunnuusseedd mechanism for dealing  with
  689.        this problem; this feature is still supported but now dep-
  690.        recated, and will go away soon  unless  the  author  hears
  691.        from people who can argue compellingly that they need it.)
  692.  
  693.        _f_l_e_x _s_c_a_n_n_e_r _j_a_m_m_e_d _-  a  scanner  compiled  with  --ss  has
  694.        encountered an input string which wasn't matched by any of
  695.        its rules.
  696.  
  697.        _w_a_r_n_i_n_g_, _r_u_l_e _c_a_n_n_o_t _b_e _m_a_t_c_h_e_d indicates that  the  given
  698.        rule cannot be matched because it follows other rules that
  699.        will always match the same text as it.  See _f_l_e_x_d_o_c_(_1_) for
  700.        an example.
  701.  
  702.        _w_a_r_n_i_n_g_,  --ss  _o_p_t_i_o_n _g_i_v_e_n _b_u_t _d_e_f_a_u_l_t _r_u_l_e _c_a_n _b_e _m_a_t_c_h_e_d
  703.        means that it is possible (perhaps only  in  a  particular
  704.        start  condition)  that the default rule (match any single
  705.        character) is the only one that will  match  a  particular
  706.        input.  Since
  707.  
  708.        _s_c_a_n_n_e_r  _i_n_p_u_t  _b_u_f_f_e_r _o_v_e_r_f_l_o_w_e_d _- a scanner rule matched
  709.        more text than the available dynamic memory.
  710.  
  711.        _t_o_k_e_n _t_o_o _l_a_r_g_e_, _e_x_c_e_e_d_s _Y_Y_L_M_A_X _- your scanner uses %%aarrrraayy
  712.        and one of its rules matched a string longer than the YYYYLL--
  713.        MMAAXX constant (8K bytes by default).  You can increase  the
  714.        value  by #define'ing YYYYLLMMAAXX in the definitions section of
  715.        your _f_l_e_x input.
  716.  
  717.        _s_c_a_n_n_e_r _r_e_q_u_i_r_e_s _-_8 _f_l_a_g _t_o _u_s_e _t_h_e _c_h_a_r_a_c_t_e_r _'_x_'  _-  Your
  718.        scanner specification includes recognizing the 8-bit char-
  719.        acter _'_x_' and you did not specify the -8  flag,  and  your
  720.        scanner defaulted to 7-bit because you used the --CCff or --CCFF
  721.  
  722.  
  723.  
  724. Version 2.4               November 1993                        11
  725.  
  726.  
  727.  
  728.  
  729.  
  730. FLEX(1)                                                   FLEX(1)
  731.  
  732.  
  733.        table compression options.
  734.  
  735.        _f_l_e_x _s_c_a_n_n_e_r _p_u_s_h_-_b_a_c_k _o_v_e_r_f_l_o_w _- you used uunnppuutt(()) to push
  736.        back so much text that the scanner's buffer could not hold
  737.        both the pushed-back text and the current token in yyyytteexxtt..
  738.        Ideally  the  scanner should dynamically resize the buffer
  739.        in this case, but at present it does not.
  740.  
  741.        _i_n_p_u_t _b_u_f_f_e_r _o_v_e_r_f_l_o_w_, _c_a_n_'_t _e_n_l_a_r_g_e _b_u_f_f_e_r _b_e_c_a_u_s_e  _s_c_a_n_-
  742.        _n_e_r  _u_s_e_s  _R_E_J_E_C_T _- the scanner was working on matching an
  743.        extremely large token  and  needed  to  expand  the  input
  744.        buffer.   This doesn't work with scanners that use RREEJJEECCTT..
  745.  
  746.        _f_a_t_a_l _f_l_e_x _s_c_a_n_n_e_r _i_n_t_e_r_n_a_l _e_r_r_o_r_-_-_e_n_d _o_f _b_u_f_f_e_r _m_i_s_s_e_d  _-
  747.        This  can  occur  in an scanner which is reentered after a
  748.        long-jump has jumped out (or over) the  scanner's  activa-
  749.        tion frame.  Before reentering the scanner, use:
  750.  
  751.            yyrestart( yyin );
  752.  
  753.        or  use  C++  scanner  classes  (the --++ option), which are
  754.        fully reentrant.
  755.  
  756. AAUUTTHHOORR
  757.        Vern Paxson, with the help of many ideas and much inspira-
  758.        tion   from   Van   Jacobson.   Original  version  by  Jef
  759.        Poskanzer.
  760.  
  761.        See flexdoc(1) for additional credits and the  address  to
  762.        send comments to.
  763.  
  764. DDEEFFIICCIIEENNCCIIEESS // BBUUGGSS
  765.        Some  trailing context patterns cannot be properly matched
  766.        and generate warning messages  ("dangerous  trailing  con-
  767.        text").   These are patterns where the ending of the first
  768.        part of the rule matches the beginning of the second part,
  769.        such  as  "zx*/xy*", where the 'x*' matches the 'x' at the
  770.        beginning of the trailing context.  (Note that  the  POSIX
  771.        draft  states  that  the  text matched by such patterns is
  772.        undefined.)
  773.  
  774.        For some trailing context rules, parts which are  actually
  775.        fixed-length  are  not  recognized as such, leading to the
  776.        abovementioned performance  loss.   In  particular,  parts
  777.        using  '|' or {n} (such as "foo{3}") are always considered
  778.        variable-length.
  779.  
  780.        Combining trailing context with the special '|' action can
  781.        result  in  _f_i_x_e_d  trailing  context being turned into the
  782.        more expensive _v_a_r_i_a_b_l_e trailing context.  For example, in
  783.        the following:
  784.  
  785.            %%
  786.            abc      |
  787.  
  788.  
  789.  
  790. Version 2.4               November 1993                        12
  791.  
  792.  
  793.  
  794.  
  795.  
  796. FLEX(1)                                                   FLEX(1)
  797.  
  798.  
  799.            xyz/def
  800.  
  801.  
  802.        Use  of  uunnppuutt(()) or iinnppuutt(()) invalidates yytext and yyleng,
  803.        unless the %%aarrrraayy directive or  the  --ll  option  has  been
  804.        used.
  805.  
  806.        Use of unput() to push back more text than was matched can
  807.        result in the pushed-back text  matching  a  beginning-of-
  808.        line  ('^')  rule even though it didn't come at the begin-
  809.        ning of the line (though this is rare!).
  810.  
  811.        Pattern-matching of NUL's  is  substantially  slower  than
  812.        matching other characters.
  813.  
  814.        Dynamic  resizing  of  the  input  buffer  is  slow, as it
  815.        entails rescanning all the text matched so far by the cur-
  816.        rent (generally huge) token.
  817.  
  818.        _f_l_e_x  does  not generate correct #line directives for code
  819.        internal to the scanner;  thus,  bugs  in  _f_l_e_x_._s_k_l  yield
  820.        bogus line numbers.
  821.  
  822.        Due  to both buffering of input and read-ahead, you cannot
  823.        intermix calls to <stdio.h> routines, such as,  for  exam-
  824.        ple,  ggeettcchhaarr(()),,  with  _f_l_e_x  rules and expect it to work.
  825.        Call iinnppuutt(()) instead.
  826.  
  827.        The total table entries listed by the --vv flag excludes the
  828.        number  of table entries needed to determine what rule has
  829.        been matched.  The number of entries is equal to the  num-
  830.        ber  of DFA states if the scanner does not use RREEJJEECCTT,, and
  831.        somewhat greater than the number of states if it does.
  832.  
  833.        RREEJJEECCTT cannot be used with the --ff or --FF options.
  834.  
  835.        The _f_l_e_x internal algorithms need documentation.
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856. Version 2.4               November 1993                        13
  857.  
  858.  
  859.